Skip to content

fix(plugin-oracle): prevent connect crash on malformed handshake packets (#1683)#1685

Merged
datlechin merged 3 commits into
mainfrom
worktree-fix-1683-oracle-piggyback-crash
Jun 15, 2026
Merged

fix(plugin-oracle): prevent connect crash on malformed handshake packets (#1683)#1685
datlechin merged 3 commits into
mainfrom
worktree-fix-1683-oracle-piggyback-crash

Conversation

@datlechin

Copy link
Copy Markdown
Member

Fixes #1683.

Problem

TablePro crashed (EXC_BREAKPOINT / Swift trap) on the NIO channel thread when connecting to some Oracle databases. Proven by symbolicating the shipped OracleDriver 1.2.11 crash binary (UUID-matched): the trap was inside ServerSidePiggyback.decode in OracleNIO, at a non-throwing moveReaderIndex(forwardBy:). Oracle 12c+ sends a .sync server-side piggyback during normal session setup; on some servers the packet is shorter than the decoder's fixed skips, so the move ran past the buffer end and trapped. A trap is not catchable by the connection's error handling, so the whole app died on connect.

Fix

The fix lives in the OracleNIO fork: TableProApp/oracle-nio#5. This PR bumps the app's oracle-nio pin to that commit and adds the changelog entry.

The fork change hardens the connection-handshake decode path so a short or unexpected server packet surfaces a decoding error (or is ignored, for informational piggybacks) instead of trapping:

  • ServerSidePiggyback.decode uses throwing buffer moves.
  • The server-side piggyback fatalError in the channel handler is replaced with informational handling.
  • Protocol.decode FDO parsing is bounds-checked and computed in Int (no UInt8 overflow).
  • BackendError.decode batch indexing is bounds-guarded.
  • The ByteBuffer UB/SB readers throw or return nil instead of trapping on bad length prefixes.
  • Regression tests cover each path.

Notes

  • Merge oracle-nio#5 first, then the pin here points at it.
  • Registry plugin: after merge, plugin-oracle-v1.2.12 needs to be tagged so the rebuilt OracleDriver reaches users via plugin auto-update.
  • Local swift test/build is blocked by an Xcode 27 beta toolchain issue in a dependency; the fork CI and an Xcode build validate.

@datlechin datlechin merged commit 8190fd2 into main Jun 15, 2026
1 check passed
@datlechin datlechin deleted the worktree-fix-1683-oracle-piggyback-crash branch June 15, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connect to Oracle database, program bengk

1 participant